package Test;

import java.util.HashSet;
import java.util.Scanner;

/**
 * @BelongsProject: LeetCode
 * @BelongsPackage: Test
 * @Author: song
 * @CreateTime: 2022-10-10  02:51
 * @Description: TODO
 * @Version: 1.0
 */

public class stringCopy {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String string = in.nextLine();
        System.out.println(lengthStringSub(string));

    }
    public static int lengthStringSub(String s){
        HashSet<Character> set = new HashSet<>();
        int ans = 0;
        int rk = -1;
        for (int i = 0; i < s.length(); ++i) {
            if (i != 0){
                set.remove(s.charAt(i -1));
            }
            while (rk+1 < s.length() && !set.contains(s.charAt(rk+1))){
                set.add(s.charAt(rk+1));
                ++rk;
            }
            ans = Math.max(ans,rk-i +1);
        }
        return ans;
    }
}
